<template>
  <div>
    <div class="title">埋点演示（Vue）</div>
    <div class="btn btnDraw" @click="handleLogin()">登录（演示事件上报）</div>
    <div class="btn btnDraw" @click="handleTo()">跳转到列表页</div>
  </div>
</template>

<script>
import { Toast } from "vant";
export default {
  data() {
    return {};
  },
  created() {},
  methods: {
    handleTo() {
      this.$router.push("/list");
    },
    handleLogin() {
      Toast.loading({
        message: "加载中...",
        forbidClick: true
      });
      this.$dhtrack.trackEvent("loginSuccess", {
        loginTime: new Date().getTime()
      });
      setTimeout(() => {
        Toast("登录成功");
      }, 1000);
    }
  }
};
</script>

<style>
.title {
  text-align: center;
  margin-top: 20px;
}
.btn {
  background-color: #ccc;
  border: 1px solid #ccc;
  height: 50px;
  line-height: 50px;
  margin: 20px;
  text-align: center;
}
.btnDraw {
  background-color: #2f85fc;
  color: #fff;
}
</style>
